<script setup>
import {computed, onMounted} from 'vue';
import {useRoute} from 'vue-router';
import {menuStore} from "@/stores/menu.js";

// 计算路由路径
const menuPath = computed(() => {
  return (path) => {
    return menuStore().path === path
  }
})

onMounted(() => {
  menuStore().path = useRoute().path.split('/')[1];
})
</script>

<template>
  <el-container>
    <el-header>
      <div class="logo_box">
        <img class="logo_img" src="/image/logo.png" alt="">
        <span class="logo_text">华绣瑰宝</span>
      </div>
      <div class="nav_box">
        <a :class="{active:menuPath('home')}" href="/home">首页</a>
        <a :class="{active:menuPath('quiz')}" href="/quiz">闯关</a>
        <a :class="{active:menuPath('works')}" href="/works">作品</a>
        <a :class="{active:menuPath('figure')}" href="/figure">传承人物</a>
        <a :class="{active:menuPath('video')}" href="/video">视频展览</a>
        <a :class="{active:menuPath('news')}" href="/news">新闻资讯</a>
        <a :class="{active:menuPath('manage')}" href="/manage">管理</a>
        <a :class="{active:menuPath('mine')}" href="/mine">我的</a>
      </div>
    </el-header>
    <el-main>
      <RouterView/>
    </el-main>
    <el-footer>
      <div class="foot_main">
        <div class="foot_main_left">
          <div class="logo">
            <div class="logo_img">
              <img src="/image/logo.png" alt="">
            </div>
            <span>华绣瑰宝系统</span>
          </div>
          <p class="introduced">
            欢迎来到华绣瑰宝系统，这里将为您展示
            刺绣文化的精髓和魅力，感受传统与现代
            的碰撞与交融。
          </p>
          <div class="links">
            <a href="#">
              <svg xmlns="http://www.w3.org/2000/svg"
                   class="styles__StyledSVGIconPathComponent-sc-1sh3oaa-0 hwBZAL svg-icon-path-icon fill"
                   viewBox="0 0 24 24">
                <defs></defs>
                <g>
                  <path
                      d="M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"></path>
                </g>
              </svg>
            </a>
            <a href="#">
              <svg xmlns="http://www.w3.org/2000/svg"
                   class="styles__StyledSVGIconPathComponent-sc-1sh3oaa-0 hwBZAL svg-icon-path-icon fill"
                   viewBox="0 0 24 24">
                <defs></defs>
                <g>
                  <path
                      d="M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-2.06 11L15 15.28 12.06 17l.78-3.33-2.59-2.24 3.41-.29L15 8l1.34 3.14 3.41.29-2.59 2.24.78 3.33z"></path>
                </g>
              </svg>
            </a>
            <a href="#">
              <svg xmlns="http://www.w3.org/2000/svg"
                   class="styles__StyledSVGIconPathComponent-sc-1sh3oaa-0 hwBZAL svg-icon-path-icon fill"
                   viewBox="0 0 24 24">
                <defs></defs>
                <g>
                  <path
                      d="M22 3H7c-.69 0-1.23.35-1.59.88L0 12l5.41 8.11c.36.53.97.89 1.66.89H22c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"></path>
                </g>
              </svg>
            </a>
            <a href="#">
              <svg xmlns="http://www.w3.org/2000/svg"
                   class="styles__StyledSVGIconPathComponent-sc-1sh3oaa-0 hwBZAL svg-icon-path-icon fill"
                   viewBox="0 0 24 24">
                <defs></defs>
                <g>
                  <path
                      d="M4 4h7V2H4c-1.1 0-2 .9-2 2v7h2V4zm6 9l-4 5h12l-3-4-2.03 2.71L10 13zm7-4.5c0-.83-.67-1.5-1.5-1.5S14 7.67 14 8.5s.67 1.5 1.5 1.5S17 9.33 17 8.5zM20 2h-7v2h7v7h2V4c0-1.1-.9-2-2-2zm0 18h-7v2h7c1.1 0 2-.9 2-2v-7h-2v7zM4 13H2v7c0 1.1.9 2 2 2h7v-2H4v-7z"></path>
                </g>
              </svg>
            </a>
            <a href="#">
              <svg xmlns="http://www.w3.org/2000/svg"
                   class="styles__StyledSVGIconPathComponent-sc-1sh3oaa-0 hwBZAL svg-icon-path-icon fill"
                   viewBox="0 0 24 24">
                <defs></defs>
                <g>
                  <path
                      d="M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12l-4.37-6.16z"></path>
                </g>
              </svg>
            </a>
          </div>
        </div>
        <div class="foot_main_right">
          <div class="item1">
            <div class="title">标题</div>
            <div class="content1">内容名称</div>
            <div class="content2">内容名称</div>
            <div class="content3">内容名称</div>
            <div class="content4">内容名称</div>
          </div>
          <div class="item2">
            <div class="title">标题</div>
            <div class="content1">内容名称</div>
            <div class="content2">内容名称</div>
            <div class="content3">内容名称</div>
            <div class="content4">内容名称</div>
          </div>
          <div class="item3">
            <div class="title">标题</div>
            <div class="content1">内容名称</div>
            <div class="content2">内容名称</div>
            <div class="content3">内容名称</div>
            <div class="content4">内容名称</div>
          </div>
        </div>
      </div>
      <div class="foot_bottom">
        &copy;Copyright 2024, All Rights Reserved by MODAO
      </div>
    </el-footer>
  </el-container>
</template>

<style scoped lang="scss">
.el-container {
  .el-header {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #bbbbbb;
    position: relative;

    .logo_box {
      position: absolute;
      left: 50px;
      top: 50%;
      transform: translateY(-50%);
      display: flex;
      align-items: center;

      .logo_img {
        height: 40px;
        width: 40px;
        border-radius: 100%;
      }

      .logo_text {
        margin-left: 5px;
        font-family: PMZDCuShuSong, serif;
        font-weight: bold;
      }
    }

    .nav_box {
      display: flex;
      gap: 60px;
      font-weight: bold;

      a {
        text-decoration: none;
        color: black;
      }

      .active {
        color: var(--cx-color1);
      }
    }
  }

  .el-main{
    padding: 0;
  }

  .el-footer {
    height: 600px;
    padding: 0 100px;
    background-color: #151515;

    .foot_main {
      margin-top: 100px;
      display: flex;
      padding-bottom: 30px;
      border-bottom: 1px solid #4f5052;

      .foot_main_left {
        .logo {
          display: flex;
          align-items: center;

          .logo_img {
            height: 40px;
            width: 40px;
            overflow: hidden;
            border-radius: 10px;

            img {
              width: 100%;
              height: 100%;
              transform: scale(1.2);
            }
          }

          span {
            margin-left: 10px;
            color: #fff;
            font-size: 18px;
          }
        }

        .introduced {
          margin-top: 20px;
          margin-left: 20px;
          width: 320px;
          color: #ffffff;
          letter-spacing: 1.5px;
        }

        .links {
          margin-left: 30px;
          margin-top: 160px;
          display: flex;

          a {
            color: black;
            background-color: #ffffff;
            margin-right: 20px;
            padding: 5px 3px 3px;
            border-radius: 10px;

            svg {
              fill: currentColor;
              width: 20px;
              height: 20px;
            }
          }
        }
      }

      .foot_main_right {
        flex: 1;
        padding-left: 150px;
        padding-top: 5px;
        display: flex;

        .item1, .item2, .item3 {
          flex: 1;
          margin-left: 20px;
          color: #ffffff;

          .title {
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 50px;
          }

          .content1, .content2, .content3, .content4 {
            margin-bottom: 50px;
          }
        }
      }
    }

    .foot_bottom {
      padding-top: 40px;
      text-align: center;
      color: #666666;
    }
  }
}
</style>